home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_riv_comdoor1.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  304 lines

  1. # Jones 3D Cog Script
  2. #
  3. # RIV_ComDoor1.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     entered
  15.     message     exited
  16.     message     activated
  17.  
  18.     thing       player      local
  19.     thing       door
  20.     thing       button1
  21.     thing       button2
  22.     thing       camOffset1
  23.     thing       camOffset2
  24.     
  25.     surface     surf_lockedSide
  26.     
  27.     # ** sfx **
  28.     sound       snd_DoorOpen=bab_door_metal_slide_c.wav     local
  29.     sound       snd_DoorStop=bab_door_metal_stop.wav        local
  30.     sound       snd_Button=gen_wood_button.wav              local
  31.     
  32.     # ** voice lines **
  33.     sound        in_DoorLine0=Inxj098.wav                local # It won't budge.
  34.     sound        in_DoorLine1=Inxj099.wav                local # Something is holding this door closed.
  35.     sound        in_DoorLine2=Inxj096.wav                local # I can't open it.
  36.     sound        in_DoorLine3=Inxj102.wav                local # ...I can't seem to open it from this side.
  37.     
  38.     sound        in_ButtLine0=Inxj096.wav                local # I can't open it.
  39.     sound        in_ButtLine1=Inxj098.wav                local # It won't budge.
  40.     
  41.     # ** subroutines **
  42.     flex        openDoor        local
  43.     flex        closeDoor       local
  44.     flex        RandDoorLines   local
  45.     flex        RandButtLines   local
  46.     
  47.     int         open=0          local
  48.     int         playing=0       local
  49.     int         firstTime=1     local
  50.     int         but1Pushed=0    local
  51.     int         but2Pushed=0    local
  52.     int         chnl_Door       local
  53.     int         newLine         local
  54.     int         oldLine         local
  55.     int         lockedSide=0    local
  56.  
  57. end
  58.  
  59. # ========================================================================================
  60.  
  61. code
  62.  
  63. startup:
  64.  
  65.     player = GetLocalPlayerThing();
  66.     SetThingLight(button1, '0.25 0.25 0.25', 0.01, 0.5);
  67.     SetThingLight(button2, '0.25 0.25 0.25', 0.01, 0.5);
  68.     SetThingLight(door, '0.25 0.25 0.25', 0.01, 0.5);
  69.     return;
  70.     
  71. # ========================================================================================
  72.  
  73. entered:
  74.  
  75.     if(GetSenderRef() == surf_lockedSide)
  76.     {
  77.         lockedSide = 1;
  78.     }
  79.  
  80.     return;
  81.  
  82. # ========================================================================================
  83.  
  84. exited:
  85.  
  86.     if((GetSenderRef() == surf_LockedSide) && (GetSourceRef() == player))
  87.     {
  88.         lockedSide = 0;
  89.     }
  90.  
  91.     return;
  92.     
  93. # ========================================================================================
  94.  
  95. activated:
  96.  
  97.     if((GetSenderRef() == button1) && (open == 0) && (playing == 0) && (lockedSide == 0))
  98.     {
  99.         playing = 1;
  100.         Call openDoor;
  101.     }
  102.     
  103.     else if((GetSenderRef() == button2) && (open == 1) && (playing == 0))
  104.     {
  105.         playing = 1;
  106.         Call closeDoor;
  107.     }
  108.     
  109.     else if((GetSenderRef() == door) && (open == 0) && (playing == 0))
  110.     {
  111.         Call RandDoorLines;
  112.     }
  113.     
  114.     else if((GetSenderRef() == button1) || (GetSenderRef() == button2))
  115.     {
  116.         if(lockedSide == 1)
  117.         {
  118.             Call RandButtLines;
  119.         }
  120.     }
  121.     
  122.     return;
  123.     
  124. # ========================================================================================
  125.  
  126. openDoor:
  127.  
  128.     open = 1;
  129.     but1Pushed = 1;
  130.     but2Pushed = 0;
  131.  
  132.     # do cutscene stuff
  133.     MakeMeStop();
  134.     StartCutscene(0);
  135.     
  136.     #SetExtCamOffsetToThing(camOffset1);
  137.     
  138.     PlayMode(player, 60, 0);
  139.     Sleep(0.3);
  140.     
  141.     PlaySoundThing(snd_Button, button1, 1.0, 5.0, 10.0, 0);
  142.     MoveToFrame(button1, 1, 1.0);
  143.     WaitForStop(button1);
  144.     
  145.     Sleep(0.25);
  146.     
  147.     SetCollideType(door, 0);
  148.     chnl_Door = PlaySoundThing(snd_DoorOpen, door, 1.0, 5.0, 10.0, 0);
  149.     MoveToFrame(door, 1, 2.0);
  150.     WaitForStop(door);
  151.     StopSound(chnl_Door, 0.5);
  152.     PlaySoundThing(snd_DoorStop, door, 1.0, 5.0, 10.0, 0);
  153.     SetCollideType(door, 3);
  154.     
  155.     Sleep(0.25);
  156.     
  157.     PlaySoundThing(snd_Button, button1, 1.0, 5.0, 10.0, 0);
  158.     MoveToFrame(button1, 0, 1.0);
  159.     WaitForStop(button1);
  160.     playing = 0;
  161.     
  162.     #RestoreExtCam();
  163.     
  164.     # return control to player
  165.     ClearActorFlags(player, 0x200000);
  166.     EndCutscene();
  167.     
  168.     return;
  169.     
  170. # ========================================================================================
  171.  
  172. closeDoor:
  173.  
  174.     open = 0;
  175.     but1Pushed = 0;
  176.     but2Pushed = 1;
  177.     
  178.     # do cutscene stuff
  179.     MakeMeStop();
  180.     StartCutscene(0);
  181.     
  182.     #SetExtCamOffsetToThing(camOffset2);
  183.     
  184.     PlayMode(player, 60, 0);
  185.     Sleep(0.3);
  186.     
  187.     PlaySoundThing(snd_Button, button2, 1.0, 5.0, 10.0, 0);
  188.     MoveToFrame(button2, 1, 1.0);
  189.     WaitForStop(button2);
  190.     
  191.     Sleep(0.25);
  192.     
  193.     SetCollideType(door, 0);
  194.     chnl_Door = PlaySoundThing(snd_DoorOpen, door, 1.0, 5.0, 10.0, 0);
  195.     MoveToFrame(door, 0, 2.0);
  196.     WaitForStop(door);
  197.     StopSound(chnl_Door, 0.5);
  198.     PlaySoundThing(snd_DoorStop, door, 1.0, 5.0, 10.0, 0);
  199.     SetCollideType(door, 3);
  200.     
  201.     Sleep(0.25);
  202.     
  203.     PlaySoundThing(snd_Button, button2, 1.0, 5.0, 10.0, 0);
  204.     MoveToFrame(button2, 0, 1.0);
  205.     WaitForStop(button2);
  206.     playing = 0;
  207.     
  208.     #RestoreExtCam();
  209.     
  210.     # return control to player
  211.     ClearActorFlags(player, 0x200000);
  212.     EndCutscene();
  213.     
  214.     return;
  215.            
  216. # ========================================================================================
  217.  
  218. RandDoorLines:
  219.  
  220.     playing = 1;
  221.     
  222.     # do cutscene stuff
  223.     MakeMeStop();
  224.     StartCutscene(0);
  225.     
  226.     PlayMode(player, 60, 0);
  227.     Sleep(0.3);
  228.     
  229.     if(lockedSide == 1)
  230.     {
  231.         if(firstTime == 1)
  232.         {
  233.             firstTime = 0;
  234.             PlayVoice(player, in_DoorLine3, 1.0, 1);
  235.             oldLine = 3;
  236.         }
  237.         
  238.         else
  239.         {
  240.             while (newLine == oldLine)
  241.             {    
  242.                 newLine = RandBetween(0, 3); # pick new line
  243.             }
  244.             
  245.             oldLine = newLine; # remember what got picked
  246.             
  247.             PlayVoice(player, in_DoorLine0[newLine], 1.0, 1);
  248.         }
  249.     }
  250.     
  251.     else
  252.     {
  253.         while (newLine == oldLine)
  254.         {    
  255.             newLine = RandBetween(0, 1); # pick new line
  256.         }
  257.         
  258.         oldLine = newLine; # remember what got picked
  259.         
  260.         PlayVoice(player, in_DoorLine0[newLine], 1.0, 1);
  261.     }
  262.     
  263.     # return control to player
  264.     ClearActorFlags(player, 0x200000);
  265.     EndCutscene();
  266.     
  267.     playing = 0;
  268.  
  269.     return;
  270.     
  271. # ========================================================================================
  272.  
  273. RandButtLines:
  274.  
  275.     playing = 1;
  276.     
  277.     # do cutscene stuff
  278.     MakeMeStop();
  279.     StartCutscene(0);
  280.     
  281.     PlayMode(player, 60, 0);
  282.     Sleep(0.3);
  283.     
  284.     while (newLine == oldLine)
  285.     {    
  286.         newLine = RandBetween(0, 1); # pick new line
  287.     }
  288.         
  289.     oldLine = newLine; # remember what got picked
  290.        
  291.     PlayVoice(player, in_ButtLine0[newLine], 1.0, 1);
  292.     
  293.     # return control to player
  294.     ClearActorFlags(player, 0x200000);
  295.     EndCutscene();
  296.     
  297.     playing = 0;
  298.  
  299.     return;
  300.     
  301. # ========================================================================================
  302.  
  303. end
  304.